# -*- coding: utf-8 -*-
# @File Name: stepperCtlPara.py
# @File Path: M:\MAS2\PRM_Robotic_Arm\PRMCcode\tool\scripts\stepperCtlPara.py
# @Author: Ruige_Lee
# @Date:   2019-05-08 19:56:53
# @Last Modified by:   Ruige_Lee
# @Last Modified time: 2019-05-08 20:25:05
# @Email: 295054118@whut.edu.cn
# @page: https://whutddk.github.io/


import time

DIV = 32

drivenCLK = 100000000

ParaNum = 256

stepCnt = []
def createPara():

	global stepCnt

	for i in range (1,ParaNum):
		result = (10000000 // 10) // ( 2*i )
		stepCnt.append(result)

	print(stepCnt)


	pass

def createCFile():

	global stepCnt

	nowtime = time.localtime(time.time())

	with open('./stepperPara.c','w') as CFile:

		strSyntax = '/*******************************************\n'
		strSyntax = strSyntax + '****** Wuhan university of technology ******\n'
		strSyntax = strSyntax + '****** Ruige Lee ******\n'
		strSyntax = strSyntax + 'year: ' + str(nowtime.tm_year) + '\n'
		strSyntax = strSyntax + 'month: ' + str(nowtime.tm_mon) + '\n'
		strSyntax = strSyntax + 'date: ' + str(nowtime.tm_mday) + '\n'
		strSyntax = strSyntax + 'hour: ' + str(nowtime.tm_hour) + '\n'
		strSyntax = strSyntax + 'minutes: ' + str(nowtime.tm_min) + '\n'
		strSyntax = strSyntax + 'second: ' + str(nowtime.tm_sec) + '\n'
		strSyntax = strSyntax + '********************************************/\n\n'



		strSyntax = strSyntax +'\n#include <stdint.h>\n'
		strSyntax = strSyntax + 'const int32_t stepPara['+ str(ParaNum) +'] = {\n1000001,\n'
		for i in range (0,ParaNum-1):
			strSyntax = strSyntax + str(stepCnt[i]) +', \n'

		strSyntax = strSyntax[0:-3] + '\n};\n\n' 

		CFile.write(strSyntax) 

	pass


def createVFile():
	pass



createPara()
createCFile()



